home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 June: Reference Library / Dev.CD Jun 99 RL Disk 1.toast / Technical Documentation / Develop / Additional Articles / Developing Symbiotic Apps / Symbiotic Samples / Symbiotic client source / Trident.cw10_pp / CTridentwhoView.cp < prev    next >
Encoding:
Text File  |  1996-10-09  |  3.0 KB  |  134 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CTridentwhoView.cp                        ©1993 Metrowerks Inc. All rights reserved.
  3. // ===========================================================================
  4. //
  5. //    A View for demonstrating large Image sizes
  6. //
  7. //    View draws the vertical Image coordinate at 20 pixel intervals.
  8. //
  9. //    Clicking, holding, and dragging the mouse outside the View's frame
  10. //    autoscrolls the View
  11.  
  12. #include "CTridentwhoView.h"
  13. #include "CTridentApp.h"
  14. #include "CTridentCmds.h"
  15. #include "TridentAESuite.h"
  16. #include <LStream.h>
  17. //#include <string.h>
  18.  
  19. #ifndef __TOOLUTILS__
  20. #include <ToolUtils.h>
  21. #endif
  22.  
  23. #include <Lists.h>
  24.  
  25. CTridentwhoView*
  26. CTridentwhoView::CreateTridentViewStreamA(
  27.     LStream    *inStream)
  28. {
  29.     return (new CTridentwhoView(inStream));
  30. }
  31.  
  32. CTridentwhoView::CTridentwhoView(
  33.     LStream    *inStream)
  34.             : CTridentView(inStream)
  35. {
  36. }
  37.  
  38. CTridentwhoView::CTridentwhoView()
  39. {
  40. }
  41.  
  42. CTridentwhoView::~CTridentwhoView()
  43. {
  44. }
  45.  
  46.  
  47. void
  48. CTridentwhoView::HandleAppleEvent(
  49.     const AppleEvent    &inAppleEvent,
  50.     AppleEvent            &outAEReply,
  51.     AEDesc                &outResult,
  52.     long                inAENumber)
  53. {
  54.     OSErr err;
  55.     Str255 theLine;
  56. //    DescType actualCode;
  57.     DescType     actualType;
  58.     long actualSize;
  59. //    char* theData[100];
  60.     long count;
  61.     AEKeyword    theKey;
  62.     AEDescList    theSubList;        // each array, ie ConfigList
  63. //    AERecord    theRecord;        // One object on server.
  64.  
  65.     switch (inAENumber)
  66.         {
  67.         case ae_Close:
  68.             SysBeep(3);
  69.             break;
  70.         case 408:
  71.         case keyMessageCode:
  72.             this->ResetTicks();   //it is alive!   (the host that is)
  73.             if (AEGetParamDesc(&inAppleEvent, 'msgs', typeAEList, &theSubList) == noErr)
  74.                 {
  75.                 err = AECountItems(&theSubList, &count);
  76.  
  77.                 ListHandle theList = this->GetMacListH();
  78.                 LDelRow(0, 1, theList);   //0 means delete all
  79.  
  80.                 while (count > 0)
  81.                     {
  82.                     err = AEGetNthPtr(&theSubList, count, typeChar, &theKey, &actualType, &theLine[1], sizeof(Str255), &actualSize);   //counting down!
  83.                     if (err != noErr)
  84.                         continue;
  85. //                    theLine[0] = actualSize-1;
  86.                     theLine[0] = actualSize;
  87.                     LAddRow(1,0, theList);
  88.                     Cell    theSelection = {0, 0};
  89.                     this->SelectOneCell(theSelection);
  90.                     this->SetDescriptor((ConstStr255Param)&theLine);
  91.                     ::LSetSelect(FALSE, theSelection, theList);
  92.  
  93.                     count--;  //remember, last of the list are inserted first so we count down
  94.                     }                        
  95.                 }
  96.                 AEDisposeDesc(&theSubList);
  97.             break;
  98.         default:
  99.  
  100.             inherited::HandleAppleEvent(inAppleEvent, outAEReply,
  101.                                 outResult, inAENumber);
  102.             break;
  103.         }
  104.  
  105. }
  106. void
  107. CTridentwhoView::FindCommandStatus(
  108.     CommandT    inCommand,
  109.     Boolean        &outEnabled,
  110.     Boolean        &outUsesMark,
  111.     Char16        &outMark,
  112.     Str255        outName)
  113. {
  114.     outMark = 18;
  115.     switch (inCommand) {
  116.     
  117.         // Return menu item status according to command messages.
  118.         // Any that you don't handle will be passed to LApplication
  119.         case 421:
  120.         case 422:
  121.         case 423:
  122.         case 424:
  123.         case 425:
  124.             outEnabled = FALSE;   //memu not used by who ... its sent when it changes  
  125.             outMark = 0;
  126.             outUsesMark = FALSE;  
  127.             break;
  128.         default:
  129.             inherited::FindCommandStatus(inCommand, outEnabled,
  130.                                     outUsesMark, outMark, outName);
  131.             break;
  132.         }
  133. }
  134.